﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.RoboticOperationMerge.CUiROMSettingsForm
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using C1.Win.C1FlexGrid;
using EngineeringInternalExtension;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Resources;
using System.Windows.Forms;
using Tecnomatix.Engineering;
using Tecnomatix.Engineering.Ui;
using Tecnomatix.Engineering.Ui48;


namespace DnProcessSimulateCommands.RoboticOperationMerge;

public class CUiROMSettingsForm : TxForm
{
  private int SCHEMA;
  private int DEFAULT = 1;
  private int ALTERNATE = 2;
  private int VIA_LOCATION = 3;
  private int OPERATION = 4;
  private int EMPTY = 1;
  private int POSITION = 2;
  private int ORIENTATION = 3;
  private int ORIENTATION_KEEP = 4;
  private int EXTERNAL = 5;
  private int TAUGHT = 6;
  private int ROBOT_CONFIGURATION = 7;
  private int ROBOTIC_PARAMETRS = 8;
  private int OLP = 9;
  private int ATTRIBUTES = 10;
  private int NAME = 11;
  private CUiROMAutomaticMatchSettings m_automaticMatchSettings;
  private CUiROMMergeSettings CUiROMMergeSettings;
  private CUiROMAutomaticLogSettings m_automaticLogSettings;
  private bool m_shouldUpdateSettings;
  private bool m_wasForcedCheckedChanged;
  private CellStyle m_disabled;
  private CellStyle m_enabled;
  private IContainer components;
  private Button m_cancelButton;
  private Button m_okButton;
  private Label m_actionsLabel;
  private GroupBox m_mergeActionsGroupBox;
  private GroupBox m_automaticMatchingAreaGroupBox;
  private Label label1;
  private RadioButton m_amcDistanceRadioButton;
  private RadioButton m_amcNameRadioButton;
  private Label m_maxDistanceUnitLabel;
  private TxNumericEditBoxCtrl m_maximumDistanceEditBox;
  private CheckBox m_amcCaseSensitiveCheckBox;
  private CheckBox m_showLogAutoCheckBox;
  private GroupBox m_logGroupBox;
  private TxFlexGrid txFlexGrid1;
  private Label m_maxDeviationUnitLabel;
  private TxNumericEditBoxCtrl m_maximumDeviationEditBox;
  private Label label2;
  private CheckBox m_perpendicularDirectionCheckBox;

  public CUiROMSettingsForm()
  {
    this.InitializeComponent();
    if (TxApplication.PlatformType == 3)
    {
      string str = this.GetResourceManager().GetString("ROBOT_EXPERT_SEAM_LOCATION_CAPTION");
      ColumnCollection cols = ((C1FlexGridBase) this.txFlexGrid1).Cols;
      cols[1].Caption = str;
      cols[2].Caption = str;
    }
    this.m_shouldUpdateSettings = false;
    this.m_automaticMatchSettings = new CUiROMAutomaticMatchSettings();
    this.CUiROMMergeSettings = new CUiROMMergeSettings();
    this.m_wasForcedCheckedChanged = false;
  }

  private ResourceManager GetResourceManager()
  {
    return new ResourceManager("DnProcessSimulateCommands.RoboticOperationMerge.Res.ResourceTable", ((object) this).GetType().Assembly);
  }

  internal void ShowDialog(CUiROMAutomaticLogSettings automaticLogSettings)
  {
    this.m_disabled = ((C1FlexGridBase) this.txFlexGrid1).Styles.Add("ReadOnly");
    this.m_enabled = ((C1FlexGridBase) this.txFlexGrid1).Styles.Add("EnabledModify");
    this.m_enabled.ForeColor = SystemColors.ControlText;
    this.m_shouldUpdateSettings = false;
    if (automaticLogSettings != null)
      this.m_automaticLogSettings = automaticLogSettings;
    this.SetHeaders();
    this.InitFormBySettings();
    this.UpdateOkButtonEnabler();
    this.UpdateMaxDistance();
    this.UpdateMaxAngle();
    this.RegisterForEvents();
    int num = (int) ((Form) this).ShowDialog();
  }

  private void SetOperationColumns()
  {
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.POSITION, this.OPERATION, (object) false);
    ((C1FlexGridBase) this.txFlexGrid1).SetCellStyle(this.POSITION, this.OPERATION, this.m_disabled);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.ORIENTATION, this.OPERATION, (object) false);
    ((C1FlexGridBase) this.txFlexGrid1).SetCellStyle(this.ORIENTATION, this.OPERATION, this.m_disabled);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.ORIENTATION_KEEP, this.OPERATION, (object) false);
    ((C1FlexGridBase) this.txFlexGrid1).SetCellStyle(this.ORIENTATION_KEEP, this.OPERATION, this.m_disabled);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.EXTERNAL, this.OPERATION, (object) false);
    ((C1FlexGridBase) this.txFlexGrid1).SetCellStyle(this.EXTERNAL, this.OPERATION, this.m_disabled);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.TAUGHT, this.OPERATION, (object) false);
    ((C1FlexGridBase) this.txFlexGrid1).SetCellStyle(this.TAUGHT, this.OPERATION, this.m_disabled);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.ROBOT_CONFIGURATION, this.OPERATION, (object) false);
    ((C1FlexGridBase) this.txFlexGrid1).SetCellStyle(this.ROBOT_CONFIGURATION, this.OPERATION, this.m_disabled);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.ROBOTIC_PARAMETRS, this.OPERATION, (object) CUiROMMergeSettings.CopyOperationRoboticParameters);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.OLP, this.OPERATION, (object) CUiROMMergeSettings.CopyOperationOlpCommands);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.ATTRIBUTES, this.OPERATION, (object) CUiROMMergeSettings.CopyOperationAttributes);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.NAME, this.OPERATION, (object) CUiROMMergeSettings.CopyOperationName);
  }

  private void SetViaLocationColumns()
  {
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.POSITION, this.VIA_LOCATION, (object) CUiROMMergeSettings.CopyViaPosition);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.ORIENTATION, this.VIA_LOCATION, (object) CUiROMMergeSettings.CopyViaOrientationAll);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.ORIENTATION_KEEP, this.VIA_LOCATION, (object) false);
    ((C1FlexGridBase) this.txFlexGrid1).SetCellStyle(this.ORIENTATION_KEEP, this.VIA_LOCATION, this.m_disabled);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.EXTERNAL, this.VIA_LOCATION, (object) CUiROMMergeSettings.CopyViaExternalAxis);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.TAUGHT, this.VIA_LOCATION, (object) CUiROMMergeSettings.CopyViaTaught);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.ROBOT_CONFIGURATION, this.VIA_LOCATION, (object) CUiROMMergeSettings.CopyViaRobotConfiguration);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.ROBOTIC_PARAMETRS, this.VIA_LOCATION, (object) CUiROMMergeSettings.CopyViaRoboticParameters);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.OLP, this.VIA_LOCATION, (object) CUiROMMergeSettings.CopyViaOlpCommands);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.ATTRIBUTES, this.VIA_LOCATION, (object) CUiROMMergeSettings.CopyViaAttributes);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.NAME, this.VIA_LOCATION, (object) CUiROMMergeSettings.CopyViaName);
  }

  private void SetAlternateColumns()
  {
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.POSITION, this.ALTERNATE, (object) CUiROMMergeSettings.CopyAlternatePosition);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.ORIENTATION, this.ALTERNATE, (object) CUiROMMergeSettings.CopyAlternateOrientationAll);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.ORIENTATION_KEEP, this.ALTERNATE, (object) CUiROMMergeSettings.CopyAlternateOrientationExceptPerpendicular);
    if (!CUiROMMergeSettings.CopyAlternateOrientationAll)
      ((C1FlexGridBase) this.txFlexGrid1).SetCellStyle(this.ORIENTATION_KEEP, this.ALTERNATE, this.m_disabled);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.EXTERNAL, this.ALTERNATE, (object) CUiROMMergeSettings.CopyAlternateExternalAxis);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.TAUGHT, this.ALTERNATE, (object) CUiROMMergeSettings.CopyAlternateTaught);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.ROBOT_CONFIGURATION, this.ALTERNATE, (object) CUiROMMergeSettings.CopyAlternateRobotConfiguration);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.ROBOTIC_PARAMETRS, this.ALTERNATE, (object) CUiROMMergeSettings.CopyAlternateRoboticParameters);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.OLP, this.ALTERNATE, (object) CUiROMMergeSettings.CopyAlternateOlpCommands);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.ATTRIBUTES, this.ALTERNATE, (object) CUiROMMergeSettings.CopyAlternateAttributes);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.NAME, this.ALTERNATE, (object) CUiROMMergeSettings.CopyAlternateName);
  }

  private void SetDefaultColumns()
  {
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.POSITION, this.DEFAULT, (object) CUiROMMergeSettings.CopyDefaultPosition);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.ORIENTATION, this.DEFAULT, (object) CUiROMMergeSettings.CopyDefaultOrientationAll);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.ORIENTATION_KEEP, this.DEFAULT, (object) CUiROMMergeSettings.CopyDefaultOrientationExceptPerpendicular);
    if (!CUiROMMergeSettings.CopyDefaultOrientationAll)
      ((C1FlexGridBase) this.txFlexGrid1).SetCellStyle(this.ORIENTATION_KEEP, this.DEFAULT, this.m_disabled);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.EXTERNAL, this.DEFAULT, (object) CUiROMMergeSettings.CopyDefaultExternalAxis);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.TAUGHT, this.DEFAULT, (object) CUiROMMergeSettings.CopyDefaultTaught);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.ROBOT_CONFIGURATION, this.DEFAULT, (object) CUiROMMergeSettings.CopyDefaultRobotConfiguration);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.ROBOTIC_PARAMETRS, this.DEFAULT, (object) CUiROMMergeSettings.CopyDefaultRoboticParameters);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.OLP, this.DEFAULT, (object) CUiROMMergeSettings.CopyDefaultOlpCommands);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.ATTRIBUTES, this.DEFAULT, (object) CUiROMMergeSettings.CopyDefaultAttributes);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.NAME, this.DEFAULT, (object) CUiROMMergeSettings.CopyDefaultName);
  }

  private void SetSchemaColumns()
  {
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.POSITION, this.SCHEMA, (object) CApROMStringTable.Position);
    ((C1FlexGridBase) this.txFlexGrid1).SetCellStyle(this.POSITION, this.SCHEMA, "Normal");
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.ORIENTATION, this.SCHEMA, (object) CApROMStringTable.Orientation);
    ((C1FlexGridBase) this.txFlexGrid1).SetCellStyle(this.ORIENTATION, this.SCHEMA, "Normal");
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.ORIENTATION_KEEP, this.SCHEMA, (object) CApROMStringTable.keep_only);
    ((C1FlexGridBase) this.txFlexGrid1).SetCellStyle(this.ORIENTATION_KEEP, this.SCHEMA, "Normal");
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.EXTERNAL, this.SCHEMA, (object) CApROMStringTable.External_axis);
    ((C1FlexGridBase) this.txFlexGrid1).SetCellStyle(this.EXTERNAL, this.SCHEMA, "Normal");
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.TAUGHT, this.SCHEMA, (object) CApROMStringTable.Taught_Position);
    ((C1FlexGridBase) this.txFlexGrid1).SetCellStyle(this.TAUGHT, this.SCHEMA, "Normal");
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.ROBOT_CONFIGURATION, this.SCHEMA, (object) CApROMStringTable.Robot_configuration);
    ((C1FlexGridBase) this.txFlexGrid1).SetCellStyle(this.ROBOT_CONFIGURATION, this.SCHEMA, "Normal");
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.ROBOTIC_PARAMETRS, this.SCHEMA, (object) CApROMStringTable.Robotic_parameters);
    ((C1FlexGridBase) this.txFlexGrid1).SetCellStyle(this.ROBOTIC_PARAMETRS, this.SCHEMA, "Normal");
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.OLP, this.SCHEMA, (object) CApROMStringTable.OLP_commands);
    ((C1FlexGridBase) this.txFlexGrid1).SetCellStyle(this.OLP, this.SCHEMA, "Normal");
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.ATTRIBUTES, this.SCHEMA, (object) CApROMStringTable.Attributes);
    ((C1FlexGridBase) this.txFlexGrid1).SetCellStyle(this.ATTRIBUTES, this.SCHEMA, "Normal");
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.NAME, this.SCHEMA, (object) CApROMStringTable.Name);
    ((C1FlexGridBase) this.txFlexGrid1).SetCellStyle(this.NAME, this.SCHEMA, "Normal");
  }

  private void SetHeaders()
  {
    ((C1.Win.C1FlexGrid.C1FlexGrid) this.txFlexGrid1).AllowMerging = (AllowMergingEnum) 8;
    ((C1.Win.C1FlexGrid.C1FlexGrid) this.txFlexGrid1).MergedRanges.Add(((C1FlexGridBase) this.txFlexGrid1).GetCellRange(this.SCHEMA, this.DEFAULT, this.SCHEMA, this.ALTERNATE));
    ((C1.Win.C1FlexGrid.C1FlexGrid) this.txFlexGrid1).MergedRanges.Add(((C1FlexGridBase) this.txFlexGrid1).GetCellRange(this.SCHEMA, this.SCHEMA, this.EMPTY, this.SCHEMA));
    ((C1.Win.C1FlexGrid.C1FlexGrid) this.txFlexGrid1).MergedRanges.Add(((C1FlexGridBase) this.txFlexGrid1).GetCellRange(this.SCHEMA, this.VIA_LOCATION, this.EMPTY, this.VIA_LOCATION));
    ((C1.Win.C1FlexGrid.C1FlexGrid) this.txFlexGrid1).MergedRanges.Add(((C1FlexGridBase) this.txFlexGrid1).GetCellRange(this.SCHEMA, this.OPERATION, this.EMPTY, this.OPERATION));
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.EMPTY, this.DEFAULT, (object) CApROMStringTable.Default);
    ((C1FlexGridBase) this.txFlexGrid1).SetData(this.EMPTY, this.ALTERNATE, (object) CApROMStringTable.Alternate);
  }

  protected virtual void OnClosing(CancelEventArgs e)
  {
    if (this.m_shouldUpdateSettings)
      this.UpdateSettingsByForm();
    this.UnRegisterForEvents();
    base.OnClosing(e);
  }

  private void InitFormBySettings()
  {
    this.m_maximumDeviationEditBox.Value = CUiROMAutomaticMatchSettings.MaximumDeviation;
    this.m_maximumDistanceEditBox.Value = CUiROMAutomaticMatchSettings.MaximumDistance;
    this.m_amcCaseSensitiveCheckBox.Checked = CUiROMAutomaticMatchSettings.MatchByNameCaseSensitive;
    switch (CUiROMAutomaticMatchSettings.Criteria)
    {
      case CUiROMDataUtils.AutomaticMatchCriteria.MatchByName:
        this.m_amcNameRadioButton.Checked = true;
        this.m_amcCaseSensitiveCheckBox.Enabled = true;
        this.m_amcDistanceRadioButton.Checked = false;
        this.m_maximumDistanceEditBox.Enabled = false;
        this.m_perpendicularDirectionCheckBox.Enabled = false;
        this.m_maximumDeviationEditBox.Enabled = false;
        break;
      case CUiROMDataUtils.AutomaticMatchCriteria.MatchByDistanceWithMaxDeviation:
        this.m_amcNameRadioButton.Checked = false;
        this.m_amcCaseSensitiveCheckBox.Enabled = false;
        this.m_amcDistanceRadioButton.Checked = true;
        this.m_maximumDistanceEditBox.Enabled = true;
        this.m_perpendicularDirectionCheckBox.Enabled = true;
        this.m_perpendicularDirectionCheckBox.Checked = true;
        this.m_maximumDeviationEditBox.Enabled = true;
        break;
      default:
        this.m_amcNameRadioButton.Checked = false;
        this.m_amcCaseSensitiveCheckBox.Enabled = false;
        this.m_amcDistanceRadioButton.Checked = true;
        this.m_maximumDistanceEditBox.Enabled = true;
        this.m_perpendicularDirectionCheckBox.Enabled = true;
        this.m_perpendicularDirectionCheckBox.Checked = false;
        break;
    }
    this.SetSchemaColumns();
    this.SetDefaultColumns();
    this.SetAlternateColumns();
    this.SetViaLocationColumns();
    this.SetOperationColumns();
    this.m_showLogAutoCheckBox.Checked = this.m_automaticLogSettings.ShowLogAutomatic;
  }

  private void UpdateSettingsByForm()
  {
    CUiROMAutomaticMatchSettings.MaximumDeviation = this.m_maximumDeviationEditBox.Value;
    CUiROMAutomaticMatchSettings.MaximumDistance = this.m_maximumDistanceEditBox.Value;
    CUiROMAutomaticMatchSettings.MatchByNameCaseSensitive = this.m_amcCaseSensitiveCheckBox.Checked;
    if (this.m_amcNameRadioButton.Checked)
      CUiROMAutomaticMatchSettings.Criteria = CUiROMDataUtils.AutomaticMatchCriteria.MatchByName;
    else if (this.m_amcDistanceRadioButton.Checked)
      CUiROMAutomaticMatchSettings.Criteria = CUiROMDataUtils.AutomaticMatchCriteria.MatchByDistance;
    if (this.m_perpendicularDirectionCheckBox.Checked && this.m_perpendicularDirectionCheckBox.Enabled)
      CUiROMAutomaticMatchSettings.Criteria = CUiROMDataUtils.AutomaticMatchCriteria.MatchByDistanceWithMaxDeviation;
    this.UpdateDefaultSettings();
    this.UpdateAlternateSettings();
    this.UpdateViaSettings();
    this.UpdateOperationSettings();
    this.m_automaticLogSettings.ShowLogAutomatic = this.m_showLogAutoCheckBox.Checked;
  }

  private void UpdateDefaultSettings()
  {
    CUiROMMergeSettings.CopyDefaultPosition = ((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.POSITION, this.DEFAULT) == 1;
    CUiROMMergeSettings.CopyDefaultOrientationAll = ((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.ORIENTATION, this.DEFAULT) == 1;
    CUiROMMergeSettings.CopyDefaultOrientationExceptPerpendicular = ((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.ORIENTATION_KEEP, this.DEFAULT) == 1;
    CUiROMMergeSettings.CopyDefaultExternalAxis = ((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.EXTERNAL, this.DEFAULT) == 1;
    CUiROMMergeSettings.CopyDefaultTaught = ((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.TAUGHT, this.DEFAULT) == 1;
    CUiROMMergeSettings.CopyDefaultRobotConfiguration = ((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.ROBOT_CONFIGURATION, this.DEFAULT) == 1;
    CUiROMMergeSettings.CopyDefaultRoboticParameters = ((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.ROBOTIC_PARAMETRS, this.DEFAULT) == 1;
    CUiROMMergeSettings.CopyDefaultOlpCommands = ((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.OLP, this.DEFAULT) == 1;
    CUiROMMergeSettings.CopyDefaultAttributes = ((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.ATTRIBUTES, this.DEFAULT) == 1;
    if (((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.NAME, this.DEFAULT) == 1)
      CUiROMMergeSettings.CopyDefaultName = true;
    else
      CUiROMMergeSettings.CopyDefaultName = false;
  }

  private void UpdateAlternateSettings()
  {
    CUiROMMergeSettings.CopyAlternatePosition = ((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.POSITION, this.ALTERNATE) == 1;
    CUiROMMergeSettings.CopyAlternateOrientationAll = ((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.ORIENTATION, this.ALTERNATE) == 1;
    CUiROMMergeSettings.CopyAlternateOrientationExceptPerpendicular = ((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.ORIENTATION_KEEP, this.ALTERNATE) == 1;
    CUiROMMergeSettings.CopyAlternateExternalAxis = ((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.EXTERNAL, this.ALTERNATE) == 1;
    CUiROMMergeSettings.CopyAlternateTaught = ((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.TAUGHT, this.ALTERNATE) == 1;
    CUiROMMergeSettings.CopyAlternateRobotConfiguration = ((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.ROBOT_CONFIGURATION, this.ALTERNATE) == 1;
    CUiROMMergeSettings.CopyAlternateRoboticParameters = ((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.ROBOTIC_PARAMETRS, this.ALTERNATE) == 1;
    CUiROMMergeSettings.CopyAlternateOlpCommands = ((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.OLP, this.ALTERNATE) == 1;
    CUiROMMergeSettings.CopyAlternateAttributes = ((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.ATTRIBUTES, this.ALTERNATE) == 1;
    if (((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.NAME, this.ALTERNATE) == 1)
      CUiROMMergeSettings.CopyAlternateName = true;
    else
      CUiROMMergeSettings.CopyAlternateName = false;
  }

  private void UpdateViaSettings()
  {
    CUiROMMergeSettings.CopyViaPosition = ((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.POSITION, this.VIA_LOCATION) == 1;
    CUiROMMergeSettings.CopyViaOrientationAll = ((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.ORIENTATION, this.VIA_LOCATION) == 1;
    CUiROMMergeSettings.CopyViaExternalAxis = ((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.EXTERNAL, this.VIA_LOCATION) == 1;
    CUiROMMergeSettings.CopyViaTaught = ((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.TAUGHT, this.VIA_LOCATION) == 1;
    CUiROMMergeSettings.CopyViaRobotConfiguration = ((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.ROBOT_CONFIGURATION, this.VIA_LOCATION) == 1;
    CUiROMMergeSettings.CopyViaRoboticParameters = ((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.ROBOTIC_PARAMETRS, this.VIA_LOCATION) == 1;
    CUiROMMergeSettings.CopyViaOlpCommands = ((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.OLP, this.VIA_LOCATION) == 1;
    CUiROMMergeSettings.CopyViaAttributes = ((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.ATTRIBUTES, this.VIA_LOCATION) == 1;
    if (((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.NAME, this.VIA_LOCATION) == 1)
      CUiROMMergeSettings.CopyViaName = true;
    else
      CUiROMMergeSettings.CopyViaName = false;
  }

  private void UpdateOperationSettings()
  {
    CUiROMMergeSettings.CopyOperationRoboticParameters = ((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.ROBOTIC_PARAMETRS, this.OPERATION) == 1;
    CUiROMMergeSettings.CopyOperationOlpCommands = ((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.OLP, this.OPERATION) == 1;
    CUiROMMergeSettings.CopyOperationAttributes = ((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.ATTRIBUTES, this.OPERATION) == 1;
    if (((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(this.NAME, this.OPERATION) == 1)
      CUiROMMergeSettings.CopyOperationName = true;
    else
      CUiROMMergeSettings.CopyOperationName = false;
  }

  private void RegisterForEvents()
  {
    TxApplication.Options.Units.LinearUnitsChanged += new TxUnitsOptions_LinearUnitsChangedEventHandler(this.Units_LinearUnitsChanged);
  }

  private void UnRegisterForEvents()
  {
    TxApplication.Options.Units.LinearUnitsChanged -= new TxUnitsOptions_LinearUnitsChangedEventHandler(this.Units_LinearUnitsChanged);
  }

  private void m_okButton_Click(object sender, EventArgs e)
  {
    this.m_shouldUpdateSettings = true;
    ((Form) this).Close();
  }

  private void m_cancelButton_Click(object sender, EventArgs e)
  {
    this.m_shouldUpdateSettings = false;
    ((Form) this).Close();
  }

  private void m_amcDistanceRadioButton_CheckedChanged(object sender, EventArgs e)
  {
    this.m_maximumDistanceEditBox.Enabled = this.m_amcDistanceRadioButton.Checked;
    this.m_amcCaseSensitiveCheckBox.Enabled = !this.m_amcDistanceRadioButton.Checked;
    this.m_perpendicularDirectionCheckBox.Enabled = this.m_amcDistanceRadioButton.Checked;
    this.m_maximumDeviationEditBox.Enabled = this.m_perpendicularDirectionCheckBox.Checked && this.m_perpendicularDirectionCheckBox.Enabled;
  }

  private void m_showLogAutoCheckBox_CheckedChanged(object sender, EventArgs e)
  {
    if (!this.m_wasForcedCheckedChanged && !TxAssemblyInfoEx.IsExcelInstalled(true, ""))
    {
      if (this.m_showLogAutoCheckBox.CheckState == CheckState.Unchecked)
        return;
      this.m_wasForcedCheckedChanged = true;
      this.m_showLogAutoCheckBox.CheckState = CheckState.Unchecked;
    }
    else
      this.m_wasForcedCheckedChanged = false;
  }

  private void UpdateOkButtonEnabler()
  {
  }

  private bool UpdateLinearLabel(Label linearLabel)
  {
    bool flag = false;
    string currentLinearUnitName = this.GetCurrentLinearUnitName();
    if (currentLinearUnitName != null)
    {
      linearLabel.Text = currentLinearUnitName;
      flag = true;
    }
    return flag;
  }

  private string GetCurrentLinearUnitName()
  {
    try
    {
      return TxApplication.Options.Units.LinearUnitName;
    }
    catch
    {
      return (string) null;
    }
  }

  private bool UpdateAngularLabel(Label angularLabel)
  {
    bool flag = false;
    string currentAngularUnitName = this.GetCurrentAngularUnitName();
    if (currentAngularUnitName != null)
    {
      angularLabel.Text = currentAngularUnitName;
      flag = true;
    }
    return flag;
  }

  private string GetCurrentAngularUnitName()
  {
    try
    {
      return TxApplication.Options.Units.AngularUnitName;
    }
    catch
    {
      return (string) null;
    }
  }

  private void Units_LinearUnitsChanged(object sender, TxUnitsOptions_LinearUnitsChangedEventArgs e)
  {
    this.UpdateMaxDistance();
  }

  private bool UpdateMaxAngle()
  {
    bool flag = this.UpdateAngularLabel(this.m_maxDeviationUnitLabel);
    if (flag)
    {
      double num = this.m_maximumDeviationEditBox.Value;
      this.m_maximumDeviationEditBox.ValueType = (TxNumericEditValueType) 1;
      this.m_maximumDeviationEditBox.Value = num;
    }
    return flag;
  }

  private bool UpdateMaxDistance()
  {
    bool flag = this.UpdateLinearLabel(this.m_maxDistanceUnitLabel);
    if (flag)
    {
      double num = this.m_maximumDistanceEditBox.Value;
      this.m_maximumDistanceEditBox.ValueType = (TxNumericEditValueType) 0;
      this.m_maximumDistanceEditBox.Value = num;
    }
    return flag;
  }

  private void txFlexGrid1_BeforeEdit(object sender, RowColEventArgs e)
  {
    CellStyle cellStyle = ((C1FlexGridBase) this.txFlexGrid1).GetCellStyle(e.Row, e.Col);
    if (cellStyle == null || !(cellStyle.Name == "DisableModify") && !(cellStyle.Name == "ReadOnly"))
      return;
    e.Cancel = true;
  }

  private void txFlexGrid1_CellChecked(object sender, RowColEventArgs e)
  {
    if (e.Row != this.ORIENTATION || e.Col != this.DEFAULT && e.Col != this.ALTERNATE)
      return;
    if (((C1FlexGridBase) this.txFlexGrid1).GetCellCheck(e.Row, e.Col) == 1)
    {
      ((C1FlexGridBase) this.txFlexGrid1).SetCellStyle(e.Row + 1, e.Col, this.m_enabled);
    }
    else
    {
      ((C1FlexGridBase) this.txFlexGrid1).SetCellStyle(e.Row + 1, e.Col, this.m_disabled);
      ((C1FlexGridBase) this.txFlexGrid1).SetCellCheck(e.Row + 1, e.Col, (CheckEnum) 2);
    }
  }

  private void m_perpendicularDirectionCheckBox_CheckedChanged(object sender, EventArgs e)
  {
    this.m_maximumDeviationEditBox.Enabled = this.m_perpendicularDirectionCheckBox.Checked;
  }

  protected virtual void Dispose(bool disposing)
  {
    if (disposing && this.components != null)
      this.components.Dispose();
    base.Dispose(disposing);
  }

  private void InitializeComponent()
  {
    ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof (CUiROMSettingsForm));
    this.m_cancelButton = new Button();
    this.m_okButton = new Button();
    this.m_actionsLabel = new Label();
    this.m_mergeActionsGroupBox = new GroupBox();
    this.txFlexGrid1 = new TxFlexGrid();
    this.m_automaticMatchingAreaGroupBox = new GroupBox();
    this.m_maxDeviationUnitLabel = new Label();
    this.m_maximumDeviationEditBox = new TxNumericEditBoxCtrl();
    this.label2 = new Label();
    this.m_perpendicularDirectionCheckBox = new CheckBox();
    this.m_amcCaseSensitiveCheckBox = new CheckBox();
    this.m_maxDistanceUnitLabel = new Label();
    this.m_maximumDistanceEditBox = new TxNumericEditBoxCtrl();
    this.m_amcDistanceRadioButton = new RadioButton();
    this.m_amcNameRadioButton = new RadioButton();
    this.label1 = new Label();
    this.m_showLogAutoCheckBox = new CheckBox();
    this.m_logGroupBox = new GroupBox();
    this.m_mergeActionsGroupBox.SuspendLayout();
    ((ISupportInitialize) this.txFlexGrid1).BeginInit();
    this.m_automaticMatchingAreaGroupBox.SuspendLayout();
    this.m_logGroupBox.SuspendLayout();
    ((Control) this).SuspendLayout();
    this.m_cancelButton.DialogResult = DialogResult.Cancel;
    componentResourceManager.ApplyResources((object) this.m_cancelButton, "m_cancelButton");
    this.m_cancelButton.Name = "m_cancelButton";
    this.m_cancelButton.UseVisualStyleBackColor = true;
    this.m_cancelButton.Click += new EventHandler(this.m_cancelButton_Click);
    componentResourceManager.ApplyResources((object) this.m_okButton, "m_okButton");
    this.m_okButton.Name = "m_okButton";
    this.m_okButton.UseVisualStyleBackColor = true;
    this.m_okButton.Click += new EventHandler(this.m_okButton_Click);
    componentResourceManager.ApplyResources((object) this.m_actionsLabel, "m_actionsLabel");
    this.m_actionsLabel.Name = "m_actionsLabel";
    this.m_mergeActionsGroupBox.Controls.Add((Control) this.txFlexGrid1);
    this.m_mergeActionsGroupBox.Controls.Add((Control) this.m_actionsLabel);
    this.m_mergeActionsGroupBox.FlatStyle = FlatStyle.System;
    componentResourceManager.ApplyResources((object) this.m_mergeActionsGroupBox, "m_mergeActionsGroupBox");
    this.m_mergeActionsGroupBox.Name = "m_mergeActionsGroupBox";
    this.m_mergeActionsGroupBox.TabStop = false;
    componentResourceManager.ApplyResources((object) this.txFlexGrid1, "txFlexGrid1");
    ((C1FlexGridBase) this.txFlexGrid1).ExtendLastCol = true;
    ((Control) this.txFlexGrid1).Name = "txFlexGrid1";
    ((RowColCollection) ((C1FlexGridBase) this.txFlexGrid1).Rows).Count = 12;
    ((RowColCollection) ((C1FlexGridBase) this.txFlexGrid1).Rows).Fixed = 2;
    ((C1FlexGridBase) this.txFlexGrid1).BeforeEdit += new RowColEventHandler(this.txFlexGrid1_BeforeEdit);
    ((C1FlexGridBase) this.txFlexGrid1).CellChecked += new RowColEventHandler(this.txFlexGrid1_CellChecked);
    this.m_automaticMatchingAreaGroupBox.Controls.Add((Control) this.m_maxDeviationUnitLabel);
    this.m_automaticMatchingAreaGroupBox.Controls.Add((Control) this.m_maximumDeviationEditBox);
    this.m_automaticMatchingAreaGroupBox.Controls.Add((Control) this.label2);
    this.m_automaticMatchingAreaGroupBox.Controls.Add((Control) this.m_perpendicularDirectionCheckBox);
    this.m_automaticMatchingAreaGroupBox.Controls.Add((Control) this.m_amcCaseSensitiveCheckBox);
    this.m_automaticMatchingAreaGroupBox.Controls.Add((Control) this.m_maxDistanceUnitLabel);
    this.m_automaticMatchingAreaGroupBox.Controls.Add((Control) this.m_maximumDistanceEditBox);
    this.m_automaticMatchingAreaGroupBox.Controls.Add((Control) this.m_amcDistanceRadioButton);
    this.m_automaticMatchingAreaGroupBox.Controls.Add((Control) this.m_amcNameRadioButton);
    this.m_automaticMatchingAreaGroupBox.Controls.Add((Control) this.label1);
    this.m_automaticMatchingAreaGroupBox.FlatStyle = FlatStyle.System;
    componentResourceManager.ApplyResources((object) this.m_automaticMatchingAreaGroupBox, "m_automaticMatchingAreaGroupBox");
    this.m_automaticMatchingAreaGroupBox.Name = "m_automaticMatchingAreaGroupBox";
    this.m_automaticMatchingAreaGroupBox.TabStop = false;
    componentResourceManager.ApplyResources((object) this.m_maxDeviationUnitLabel, "m_maxDeviationUnitLabel");
    this.m_maxDeviationUnitLabel.Name = "m_maxDeviationUnitLabel";
    this.m_maximumDeviationEditBox.BorderStyle = BorderStyle.Fixed3D;
    componentResourceManager.ApplyResources((object) this.m_maximumDeviationEditBox, "m_maximumDeviationEditBox");
    this.m_maximumDeviationEditBox.LowerBound = 0.0;
    ((Control) this.m_maximumDeviationEditBox).Name = "m_maximumDeviationEditBox";
    this.m_maximumDeviationEditBox.ReadOnly = false;
    this.m_maximumDeviationEditBox.StepSize = 1.0;
    this.m_maximumDeviationEditBox.TextAlign = HorizontalAlignment.Left;
    this.m_maximumDeviationEditBox.ThousandsSeparator = false;
    this.m_maximumDeviationEditBox.UpperBound = 1000000.0;
    this.m_maximumDeviationEditBox.Value = 0.0;
    this.m_maximumDeviationEditBox.ValueType = (TxNumericEditValueType) 0;
    componentResourceManager.ApplyResources((object) this.label2, "label2");
    this.label2.Name = "label2";
    componentResourceManager.ApplyResources((object) this.m_perpendicularDirectionCheckBox, "m_perpendicularDirectionCheckBox");
    this.m_perpendicularDirectionCheckBox.Name = "m_perpendicularDirectionCheckBox";
    this.m_perpendicularDirectionCheckBox.UseVisualStyleBackColor = true;
    this.m_perpendicularDirectionCheckBox.CheckedChanged += new EventHandler(this.m_perpendicularDirectionCheckBox_CheckedChanged);
    componentResourceManager.ApplyResources((object) this.m_amcCaseSensitiveCheckBox, "m_amcCaseSensitiveCheckBox");
    this.m_amcCaseSensitiveCheckBox.Name = "m_amcCaseSensitiveCheckBox";
    this.m_amcCaseSensitiveCheckBox.UseVisualStyleBackColor = true;
    componentResourceManager.ApplyResources((object) this.m_maxDistanceUnitLabel, "m_maxDistanceUnitLabel");
    this.m_maxDistanceUnitLabel.Name = "m_maxDistanceUnitLabel";
    this.m_maximumDistanceEditBox.BorderStyle = BorderStyle.Fixed3D;
    componentResourceManager.ApplyResources((object) this.m_maximumDistanceEditBox, "m_maximumDistanceEditBox");
    this.m_maximumDistanceEditBox.LowerBound = 0.0;
    ((Control) this.m_maximumDistanceEditBox).Name = "m_maximumDistanceEditBox";
    this.m_maximumDistanceEditBox.ReadOnly = false;
    this.m_maximumDistanceEditBox.StepSize = 1.0;
    this.m_maximumDistanceEditBox.TextAlign = HorizontalAlignment.Left;
    this.m_maximumDistanceEditBox.ThousandsSeparator = false;
    this.m_maximumDistanceEditBox.UpperBound = 1000000.0;
    this.m_maximumDistanceEditBox.Value = 0.0;
    this.m_maximumDistanceEditBox.ValueType = (TxNumericEditValueType) 0;
    componentResourceManager.ApplyResources((object) this.m_amcDistanceRadioButton, "m_amcDistanceRadioButton");
    this.m_amcDistanceRadioButton.Name = "m_amcDistanceRadioButton";
    this.m_amcDistanceRadioButton.TabStop = true;
    this.m_amcDistanceRadioButton.UseVisualStyleBackColor = true;
    this.m_amcDistanceRadioButton.CheckedChanged += new EventHandler(this.m_amcDistanceRadioButton_CheckedChanged);
    componentResourceManager.ApplyResources((object) this.m_amcNameRadioButton, "m_amcNameRadioButton");
    this.m_amcNameRadioButton.Checked = true;
    this.m_amcNameRadioButton.Name = "m_amcNameRadioButton";
    this.m_amcNameRadioButton.TabStop = true;
    this.m_amcNameRadioButton.UseVisualStyleBackColor = true;
    componentResourceManager.ApplyResources((object) this.label1, "label1");
    this.label1.Name = "label1";
    componentResourceManager.ApplyResources((object) this.m_showLogAutoCheckBox, "m_showLogAutoCheckBox");
    this.m_showLogAutoCheckBox.Name = "m_showLogAutoCheckBox";
    this.m_showLogAutoCheckBox.UseVisualStyleBackColor = true;
    this.m_showLogAutoCheckBox.CheckedChanged += new EventHandler(this.m_showLogAutoCheckBox_CheckedChanged);
    this.m_logGroupBox.Controls.Add((Control) this.m_showLogAutoCheckBox);
    this.m_logGroupBox.FlatStyle = FlatStyle.System;
    componentResourceManager.ApplyResources((object) this.m_logGroupBox, "m_logGroupBox");
    this.m_logGroupBox.Name = "m_logGroupBox";
    this.m_logGroupBox.TabStop = false;
    componentResourceManager.ApplyResources((object) this, "$this");
    ((ContainerControl) this).AutoScaleMode = AutoScaleMode.Font;
    ((Control) this).Controls.Add((Control) this.m_logGroupBox);
    ((Control) this).Controls.Add((Control) this.m_automaticMatchingAreaGroupBox);
    ((Control) this).Controls.Add((Control) this.m_mergeActionsGroupBox);
    ((Control) this).Controls.Add((Control) this.m_cancelButton);
    ((Control) this).Controls.Add((Control) this.m_okButton);
    ((Form) this).FormBorderStyle = FormBorderStyle.FixedSingle;
    ((Form) this).MaximizeBox = false;
    ((Form) this).MinimizeBox = false;
    ((Control) this).Name = nameof (CUiROMSettingsForm);
    ((Form) this).ShowIcon = false;
    this.m_mergeActionsGroupBox.ResumeLayout(false);
    ((ISupportInitialize) this.txFlexGrid1).EndInit();
    this.m_automaticMatchingAreaGroupBox.ResumeLayout(false);
    this.m_automaticMatchingAreaGroupBox.PerformLayout();
    this.m_logGroupBox.ResumeLayout(false);
    this.m_logGroupBox.PerformLayout();
    ((Control) this).ResumeLayout(false);
  }
}
